﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>彩虹桥纹案编辑器</title>
    <style type="text/css">
        body{
            margin: 0;
            padding: 0;
            background-image: url("12diamond.GIF") ;
            /*            background-image: url("10rect.GIF") ;*/
            width: 2000px;
            height: 2000px;
        }
        #myCanvas{
            margin:0px 0px;
            /*            border:1px solid #c0c0c0*/
        }
        .editrect{
            position: absolute;
            left:0px; top:69px;
            width:100px; height:100px;
        }
        .textarea220{
            background: auto;
        }
        .palcolor28 {
            position: absolute;
            left: 0px;
            top: 0px;
            width: 100px;
            height: 100px;
            background:url(divback.png);
        }
        .pal {
            position: absolute;
            width:360px;
            height:69px;
            background: url(pal360x69.png);
            top:0px;
            left: 0px;
        }
        .board {
            position: absolute;
            width: 400px;
            height: 400px;
            top: 69px;
            left:100px;
            background: url(divback20.png);
        }
        .button  {
            position: absolute;
            width: 69px;
            height: 69px;
            background: "white";
            font-family: 楷体_GB2312;
            font-size: 72px;
            text-align: center;
            line-height: 69px;
            background: url(bt.png);
        }
            .div-x{ position:absolute;
                left:1920px; top:1900px;
                width:80px; height:100px;}
    </style>
    <script type="text/javascript">

        var g_img = null;

        function newrainbow28( p=-1 ) {
            var pl = 0;
            if ( p == -1 ) {
                pl = getQueryString("p");
                if ( pl == null )
                    pl = 0;
            } else
                pl = p;
            if ( pl > curpalmaxidx )
                pl = 0;
            changepalidx( pl );

            if ( g_img == null )
                g_img = new Image(28);
            var img = g_img;
            img[0] = document.getElementById("rainbow1");
            img[1] = document.getElementById("rainbow2");
            img[2] = document.getElementById("rainbow3");
            img[3] = document.getElementById("rainbow4");
            img[4] = document.getElementById("rainbow5");
            img[5] = document.getElementById("rainbow6");
            img[6] = document.getElementById("rainbow7");
            img[7] = document.getElementById("rainbow8");
            img[8] = document.getElementById("rainbow9");
            img[9] = document.getElementById("rainbow10");
            img[10] = document.getElementById("rainbow11");
            img[11] = document.getElementById("rainbow12");
            img[12] = document.getElementById("rainbow13");
            img[13] = document.getElementById("rainbow14");
            img[14] = document.getElementById("rainbow15");
            img[15] = document.getElementById("rainbow16");
            img[16] = document.getElementById("rainbow17");
            img[17] = document.getElementById("rainbow18");
            img[18] = document.getElementById("rainbow19");
            img[19] = document.getElementById("rainbow20");
            img[20] = document.getElementById("rainbow21");
            img[21] = document.getElementById("rainbow22");
            img[22] = document.getElementById("rainbow23");
            img[23] = document.getElementById("rainbow24");
            img[24] = document.getElementById("rainbow25");
            img[25] = document.getElementById("rainbow26");
            img[26] = document.getElementById("rainbow27");
            img[27] = document.getElementById("rainbow28");

            return img;
        }

        window.onload = function() {
            // 新年祝福动画，时钟
            setInterval('chanTxt()',100);

            var canvas = document.getElementById("myCanvas");
            var context = canvas.getContext("2d");

            var i, j, k;
            var img = newrainbow28(); /* new Image(28);
            img[0] = document.getElementById("rainbow1");
            img[1] = document.getElementById("rainbow2");
            img[2] = document.getElementById("rainbow3");
            img[3] = document.getElementById("rainbow4");
            img[4] = document.getElementById("rainbow5");
            img[5] = document.getElementById("rainbow6");
            img[6] = document.getElementById("rainbow7");
            img[7] = document.getElementById("rainbow8");
            img[8] = document.getElementById("rainbow9");
            img[9] = document.getElementById("rainbow10");
            img[10] = document.getElementById("rainbow11");
            img[11] = document.getElementById("rainbow12");
            img[12] = document.getElementById("rainbow13");
            img[13] = document.getElementById("rainbow14");
            img[14] = document.getElementById("rainbow15");
            img[15] = document.getElementById("rainbow16");
            img[16] = document.getElementById("rainbow17");
            img[17] = document.getElementById("rainbow18");
            img[18] = document.getElementById("rainbow19");
            img[19] = document.getElementById("rainbow20");
            img[20] = document.getElementById("rainbow21");
            img[21] = document.getElementById("rainbow22");
            img[22] = document.getElementById("rainbow23");
            img[23] = document.getElementById("rainbow24");
            img[24] = document.getElementById("rainbow25");
            img[25] = document.getElementById("rainbow26");
            img[26] = document.getElementById("rainbow27");
            img[27] = document.getElementById("rainbow28"); */

            document.onmouseup = new Function("var i=0;");

            var count = 0, p = 0;
            var buf = [];

            var wnan = getQueryString("wnan");

            if ( wnan != null && wnan.charAt(0) == 't' && wnan.charAt(1) == '|' )
                wnan = getWnanFromTime( wnan.substring( 2, wnan.length ) );
            if ( wnan == null && getQueryString("ny") != null )
                wnan = "|qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq|qq`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q```qq`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q```|q``q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q``q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`|qqq````````````````````````````````````qqq````````````````````````````````````|q```zzzzzz`qq`zzzzzzzzzzz`qq`zzzzzzz`qqq```zzzzz`qq`zzzzzzzzzzzzz`qq`zzzzzz`qq|qqq`zzzzzz`qq`zzzzzzzzzzz`qq`zzzzzzz```qqq`zzzzz`qq`zzzzzzzzzzzzz`qq`zzzzzz```|q```zzzzzz`qq```zzzzzz````qq`zzzzzzz`qqq```zzzzz`qq````zzzzzzz````qq`zzzzzz`qq|qqq`zzzzzz`qqqq`zzzzzz`qqqqq`zzzzzzz```qqq`zzzzz`qqqqq`zzzzzzz`qqqqq`zzzzzz```|q```zzzzzz`qqqq`zzzzzz`qqqqq`zzzzzzz`qqq```zzzzz`qqqqq`zzzzzzz`qqqqq`zzzzzz`qq|qqq`zzzzzz`qqqq````````qqqqq`zzzzzzz```qqq```````qqqqq`````````qq````zzzzzz```|q``````````qqqqqqqqqqqqqq````zzzzzzz`qqq```qqqqqq`qqqqqqqqqqqqqqq`zzz```````qq|qqq`qqqqqqq`qqqqqqqqqqqqq`zzz``````````qqq`qqqqqqq`qqqqqqqqqqqqqq`zzz`qqqqq```|q```qqqqqqqq`qqqqqqqqqqqq`zzz`qqqqqq`qqq``````qqqqq```````````````zzz`qqqqq`qq|qqq````qqqqqq`````````````zzz`qqqqqq```qqq`zz`qqqqq`zzzzzzzzzzzzzz````qq``````|q```zz`qqqqqq`zzzzzzzzzzzz````qqq````qqq```zz`qqqqq`zzqzqzqzqzqzzz`qqqqq`zz`qq|qqq`zz````qqq`zzizizizizzz`qqqqqq`zz```qqq`zz````qq`zqqzqzqzqzqzzz`qqqqq`zz```|q```zzzzz`qqq`ziizizizizzz`qqqqqq`zz`qqq```zzzzz`qq`zzzqqqqqqqqqqz`qq````zz`qq|qqq`zzzzz`qqq`zzziiiiiiiiz`qqq````zz```qqq`zzzzz`qq`zqqq``````qzzz`qq`zzzzz```|q```zzzzz`qqq`ziiizzzzizzz`qqq`zzzzz`qqq```zzzzz`qq`zzzq`zzzz`qqqz`qq`zzzzz`qq|qqq`zzzzz`qqq`zzzizzzziiiz`qqq`zzzzz```qqq`zzzzz`qq`zqqq`zzzz`qzzz`qq`zzzzz```|q```zzzzz`qqq`ziiizzzzizzz`qqq`zzzzz`qqq```zzzzz`qq`zzzq`zzzz`qqqz`qq`zzzzz`qq|qqq`zzzzz`qqq`zzzizzzziiiz`qqq`zzzzz```qqq`zzzzz`qq`zqqq`zzzz`qzzz`qq`zzzzz```|q```zz````qqq`ziiiiiiiizzz`qqq`zzzzz`qqq```zzzzz`qq`zzzq``````qqqz`qq`zzzzz`qq|qqq`zz`qqqqqq`zzziziziziiz`qqq`zzzzz```qqq`zz````qq`zqqqqqqqqqqzzz`qq`zzzzz```|q```zz`qqqqqq`zzzizizizizz`qqq````zz`qqq```zz`qqqqq`zzzqzqzqzqzqqz`qq````zz`qq|qqq````qqq````zzzzzzzzzzzz`qqqqqq`zz```qqq`zz`qqqqq`zzzqzqzqzqzqzz`qqqqq`zz```|q```qqqqqq`zzz`````````````qqqqqq````qqq``````qq````zzzzzzzzzzzzzz`qqqqq`zz`qq|qqq`qqqqqq`zzz`qqqqqqqqqqqq`qqqqqqqq```qqq`qqqqq`zzz```````````````qqqqq``````|q``````````zzz`qqqqqqqqqqqqq`qqqqqqq`qqq```qqqqq`zzz`qqqqqqqqqqqqqq`qqqqqqq`qq|qqq`zzzzzzz````qqqqqqqqqqqqqq``````````qqq```````zzz`qqqqqqqqqqqqqqq`qqqqqq```|q```zzzzzzz`qqqqq````````qqqq`zzzzzz`qqq```zzzzzz````qq`````````qqqqq```````qq|qqq`zzzzzzz`qqqqq`zzzzzz`qqqq`zzzzzz```qqq`zzzzzz`qqqqq`zzzzzzz`qqqqq`zzzzz```|q```zzzzzzz`qqqqq`zzzzzz`qqqq`zzzzzz`qqq```zzzzzz`qqqqq`zzzzzzz`qqqqq`zzzzz`qq|qqq`zzzzzzz`qq````zzzzzz```qq`zzzzzz```qqq`zzzzzz`qq````zzzzzzz````qq`zzzzz```|q```zzzzzzz`qq`zzzzzzzzzzz`qq`zzzzzz`qqq```zzzzzz`qq`zzzzzzzzzzzzz`qq`zzzzz`qq|qqq`zzzzzzz`qq`zzzzzzzzzzz`qq`zzzzzz```qqq`zzzzzz`qq`zzzzzzzzzzzzz`qq`zzzzz```|q````````````````````````````````````qqq````````````````````````````````````qq|q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q``q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q``|q```q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`qq```q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q";

            if ( wnan == null || wnan.length < 1 ) {

                /*
                 var testbuf = localStorage.getItem("lastname");
                 if (testbuf == null || testbuf.length < 1) {

                 for (i = 7 - 12; i < 2000; i += 12) {
                 for (j = 1 - 12; j < 2000; j += 12 * 28) {
                 for (k = 0; k < 28; k++) {
                 if (j + k * 12 < 2000 && j + k * 12 + 11 > 0) {
                 buf[count] = String.fromCharCode(p + 95); // '_'
                 context.drawImage(img[p++], j + k * 12, i);
                 count++;
                 }
                 if (p >= 28) p = 0;
                 if (j + 6 + k * 12 < 2000 && j + 6 + k * 12 + 11 > 0) {
                 buf[count] = String.fromCharCode(p + 95); // '_'
                 context.drawImage(img[p++], j + 6 + k * 12, i + 6);
                 count++;
                 }
                 if (p >= 28) p = 0;
                 }
                 }
                 }

                 } else
                 {

                 buf = testbuf;
                 var tmpstr;

                 for (i = 7 - 12; i < 2000; i += 12) {
                 for (j = 1 - 12; j < 2000; j += 12 * 28) {
                 for (k = 0; k < 28; k++) {
                 if (j + k * 12 < 2000 && j + k * 12 + 11 > 0) {
                 tmpstr = buf[count*2];
                 p = tmpstr.charCodeAt(0) - 95; // '_'
                 context.drawImage(img[p], j + k * 12, i);
                 count++;
                 }
                 if (p >= 28) p = 0;
                 if (j + 6 + k * 12 < 2000 && j + 6 + k * 12 + 11 > 0) {
                 tmpstr = buf[count*2];
                 p = tmpstr.charCodeAt(0) - 95; // '_'
                 context.drawImage(img[p], j + 6 + k * 12, i + 6);
                 count++;
                 }
                 if (p >= 28) p = 0;
                 }
                 }
                 }

                 }

                 var testedit = localStorage.getItem("lastedit");
                 if (testedit != null && testedit.length > 0) {
                 document.getElementById("er").innerHTML = testedit;
                 }
                 */
                lostAddFocus( 'remark' );
            } else {

                buf = checkRandNumber( wnan );

//                if ( buf[0] == '|' ) {
                if ( buf.charAt(1) == '|' ) {
                    drawrectbuf( buf, img, true );
                } else {
                    drawlinebuf( buf, img );
                }

                var oDiv=document.getElementById('er');
                oDiv.style.display = 'none';

                oDiv=document.getElementById('pl');
                oDiv.style.display = 'none';

            }

            // 保存当前的缓存.
            // Check browser support
            if (typeof(Storage) != "undefined") {
                // Store
                localStorage.setItem("lastname", buf);
                // Retrieve
//                document.getElementById("result").innerHTML = localStorage.getItem("lastname");
            } else {
                document.getElementById("dd").innerHTML = "抱歉！您的浏览器不支持 Web Storage ...";
            }

            var oDiv=document.getElementById('dd');
            oDiv.style.display = 'none';

            document.onmousedown=function(ev){
                var oEvent=ev||event;
                var oDiv=document.getElementById('dd');
                oDiv.style.top =oEvent.clientX+'px';  // 指定创建的DIV在文档中距离左侧的位置
                oDiv.style.left =oEvent.clientY+'px';  // 指定创建的DIV在文档中距离顶部的位置
                /*                oDiv.style.border='1px solid #FF0000'; // 设置边框
                 oDiv.style.position='absolute'; // 为新创建的DIV指定绝对定位
                 oDiv.style.width='200px'; // 指定宽度
                 oDiv.style.height='200px'; // 指定高度
                 document.body.appendChild(oDiv);

                 var D = new Function('obj', 'return document.getElementById(obj);')
                 var oevent = new Function('e', 'if (!e) e = window.event;return e')

                 style.position = "absolute"; var temp1 = offsetLeft; var temp2 = offsetTop;
                 x = oevent(e).clientX; y = oevent(e).clientY;

                 style.left = temp1 + oevent(e).clientX - x + "px";
                 style.top = temp2 + oevent(e).clientY - y + "px";
                 */
//                oDiv.style.display = 'none';
//                oDiv.style.display = 'block';
            }

        };

        function getAddFocus(id){//针对添加操作中的简介和备注，textarea获得焦点清空输入框
            var textarea=document.getElementById(id);
//            textarea.value="";

            /*
             var testbuf = localStorage.getItem("lastname");

             // 保存当前的缓存.
             // Check browser support
             if (typeof(Storage) != "undefined") {
             // Store
             localStorage.setItem("lastedit", buf);
             // Retrieve
             //                document.getElementById("result").innerHTML = localStorage.getItem("lastname");
             } else {
             document.getElementById("er").innerHTML = "抱歉！您的浏览器不支持 Web Storage ...";
             }
             */
        }

        function lostAddFocus(id) {//针对添加操作中的简介和备注，textarea失去焦点且内容为空时，显示提示信息
            var textarea = document.getElementById(id);
            var buf = textarea.value;
            if (buf == "") {
                textarea.value = "首行必须为空行";
                textarea.style.color = "gray";
            } else
            {
                //去掉回车换行
//                buf = buf.replace('|',"");
                buf = buf.replace(/[ ]/g,"");
                buf = buf.replace(/[\r\n]/g,"|");
                buf = buf.replace(/\|\|/g,"|");

                while ( buf[0] == '|' && buf[1] == '|' )
                    buf = buf.substr(1, buf.length - 1);

                while ( buf.length > 0 && buf[buf.length-1] == '|' )
                    buf = buf.substr(0, buf.length - 1);

                if ( buf[0] == '|' ) {
                    drawrectbufnoimg( buf );
                } else {
                    drawlinebufnoimg( buf );
                }
            }
            /*          // 保存当前的缓存.
             // Check browser support
             if (typeof(Storage) != "undefined") {
             // Store
             localStorage.setItem("lastedit", buf);
             // Retrieve
             //                document.getElementById("result").innerHTML = localStorage.getItem("lastname");
             } else {
             document.getElementById("er").innerHTML = "抱歉！您的浏览器不支持 Web Storage ...";
             }*/
        }

        function drawrectbufnoimg( buf ) {

            var img = newrainbow28( curpalidx ); /* new Image(28);
            img[0] = document.getElementById("rainbow1");
            img[1] = document.getElementById("rainbow2");
            img[2] = document.getElementById("rainbow3");
            img[3] = document.getElementById("rainbow4");
            img[4] = document.getElementById("rainbow5");
            img[5] = document.getElementById("rainbow6");
            img[6] = document.getElementById("rainbow7");
            img[7] = document.getElementById("rainbow8");
            img[8] = document.getElementById("rainbow9");
            img[9] = document.getElementById("rainbow10");
            img[10] = document.getElementById("rainbow11");
            img[11] = document.getElementById("rainbow12");
            img[12] = document.getElementById("rainbow13");
            img[13] = document.getElementById("rainbow14");
            img[14] = document.getElementById("rainbow15");
            img[15] = document.getElementById("rainbow16");
            img[16] = document.getElementById("rainbow17");
            img[17] = document.getElementById("rainbow18");
            img[18] = document.getElementById("rainbow19");
            img[19] = document.getElementById("rainbow20");
            img[20] = document.getElementById("rainbow21");
            img[21] = document.getElementById("rainbow22");
            img[22] = document.getElementById("rainbow23");
            img[23] = document.getElementById("rainbow24");
            img[24] = document.getElementById("rainbow25");
            img[25] = document.getElementById("rainbow26");
            img[26] = document.getElementById("rainbow27");
            img[27] = document.getElementById("rainbow28"); */

            drawrectbuf( buf, img );
        }

        function drawlinebufnoimg( buf ) {

            var img = newrainbow28( curpalidx ); /*new Image(28);
            img[0] = document.getElementById("rainbow1");
            img[1] = document.getElementById("rainbow2");
            img[2] = document.getElementById("rainbow3");
            img[3] = document.getElementById("rainbow4");
            img[4] = document.getElementById("rainbow5");
            img[5] = document.getElementById("rainbow6");
            img[6] = document.getElementById("rainbow7");
            img[7] = document.getElementById("rainbow8");
            img[8] = document.getElementById("rainbow9");
            img[9] = document.getElementById("rainbow10");
            img[10] = document.getElementById("rainbow11");
            img[11] = document.getElementById("rainbow12");
            img[12] = document.getElementById("rainbow13");
            img[13] = document.getElementById("rainbow14");
            img[14] = document.getElementById("rainbow15");
            img[15] = document.getElementById("rainbow16");
            img[16] = document.getElementById("rainbow17");
            img[17] = document.getElementById("rainbow18");
            img[18] = document.getElementById("rainbow19");
            img[19] = document.getElementById("rainbow20");
            img[20] = document.getElementById("rainbow21");
            img[21] = document.getElementById("rainbow22");
            img[22] = document.getElementById("rainbow23");
            img[23] = document.getElementById("rainbow24");
            img[24] = document.getElementById("rainbow25");
            img[25] = document.getElementById("rainbow26");
            img[26] = document.getElementById("rainbow27");
            img[27] = document.getElementById("rainbow28"); */

            drawlinebuf( buf, img );

        }

        function drawlinebuf( buf, img ) {

            var canvas = document.getElementById("myCanvas");
            var context = canvas.getContext("2d");

            var i, j, k;
            var count = 0, p = 0;
            var tmpstr;

            for (i = 7 - 12; i < 2000; i += 12) {
                for (j = 1 - 12; j < 2000; j += 12 * 28) {
                    for (k = 0; k < 28; k++) {
                        if (j + k * 12 < 2000 && j + k * 12 + 11 > 0) {
                            tmpstr = buf[count];
                            p = tmpstr.charCodeAt(0) - 95; // '_'
                            context.drawImage(img[p], j + k * 12, i);
                            count++;
                        }
                        if (p >= 28) p = 0;
                        if (count >= buf.length)
                            count = 0;
                        if (j + 6 + k * 12 < 2000 && j + 6 + k * 12 + 11 > 0) {
                            tmpstr = buf[count];
                            p = tmpstr.charCodeAt(0) - 95; // '_'
                            context.drawImage(img[p], j + 6 + k * 12, i + 6);
                            count++;
                        }
                        if (p >= 28) p = 0;
                        if (count >= buf.length)
                            count = 0;
                    }
                }
            }

        }

        function drawrectbuf( buf, img, usecharat = false ) {

            var canvas = document.getElementById("myCanvas");
            var context = canvas.getContext("2d");

            var xs = getQueryString("xs");
            var xskip = xs == 'hide' ? -1 : 0;
            var skip6 = 6 + xskip;

            var i, j, k;
            var count = 0, p = 0;
            var tmpstr;

            var lns = 0;
            var lnw = 0;
            for (i = 0; i < buf.length; i++) {
                if (usecharat) {
                    if (buf.charAt(i+1) == '|') {
                        lns++;
                        if (lns == 2)
                            lnw = i - 1;
                    }
                } else {
                    if (buf[i] == '|') {
                        lns++;
                        if (lns == 2)
                            lnw = i - 1;
                    }
                }
            }

            for (i = skip6+1 - 2*skip6 * lnw * 2; i < 2000 + 2*skip6*lnw; i += 2*skip6 * lnw ) {
                for (j = 1 - 2*skip6 * lns * 2; j < 2000 + 2*skip6*lns; j += 2*skip6 * lns) {

                    count = 0;
                    for (k = 0; k < lns; k++) {
                        var l;
                        count ++;
                        var x = k * skip6, y = k * (-skip6);
                        for ( l=0; l<lnw; l++) {

//                                    if (j + l*6 + x < 2000 && j + l*6 + x + 11 > 0) {
                            if (usecharat)
                                tmpstr = buf.charAt( count+1 );
                            else
                                tmpstr = buf[count];
                            p = tmpstr.charCodeAt(0) - 95; // '_'
                            context.drawImage(img[p], j + l*skip6 + x, i + l*skip6 + y);
//                                    }
                            count++;
                        }
                    }

                    count = 0;
                    for (k = 0; k < lns; k++) {
                        var l;
                        count ++;
                        var x = k * skip6, y = k * (-skip6);
                        for ( l=0; l<lnw; l++) {

//                                    if (j + k * 12 < 2000 && j + k * 12 + 11 > 0) {
                            if (usecharat)
                                tmpstr = buf.charAt( count+1 );
                            else
                                tmpstr = buf[count];
                            p = tmpstr.charCodeAt(0) - 95; // '_'
                            context.drawImage(img[p], j + (l+lnw)*skip6 + x, i + (l+lnw)*skip6 + y);
//                                    }
                            count++;
                        }
                    }
                }
            }

        }

        function getQueryString(name) {
            var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if(r!=null)return decodeURI(r[2]); return null;
        }

        function checkRandNumber( url ) {
            var i;
            for ( i=0; i<url.length; i++ )
            {
                if ( url.charCodeAt(i) >= 48 &&
                        url.charCodeAt(i) <= 57 ) {}

                else
                    break;
            }
            if ( i == url.length )
            {
                var len = parseInt( url );
                var mx = generateMixed( len );
                return mx;
            }
            return url;
        }

        function generateMixed(n) {
            var chars = ['_','`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
            var res = "";
            for(var i = 0; i < n ; i ++) {
                var id = Math.ceil(Math.random()*28);
                res += chars[id];
            }
            return res;
        }

        var n = 12;
        function chanTxt()
        {
            var canvas = document.getElementById("myCanvas");
            var context = canvas.getContext("2d");

            if(n <= 42)
            {
                var sizesize = n/42;
                var newyear = getQueryString("ny");
                if ( newyear != null && newyear.length > 0 ) {
                    context.font = "900 "+ ( 500 * sizesize ) + "px 隶书";
                    context.textAlign = 'center';
                    context.fillStyle = '#fff';
                    context.shadowOffsetX = 16 * sizesize;
                    context.shadowOffsetY = -16 * sizesize;
                    context.shadowColor = "#8ff";
                    context.shadowBlur = 32 * sizesize;
                    context.fillText(newyear, 1000, 500, 1800);
                    context.fillStyle = '#f00';
                    context.font = "100 "+ ( 500 * sizesize ) + "px 隶书";
                    context.shadowOffsetX = 0;
                    context.shadowOffsetY = 0;
                    context.shadowColor = "#0ff";
                    context.shadowBlur = 0;
                    context.fillText(newyear, 1000, 500, 1800);
                }
            }
            n++;
        }

    </script>


</head>
<body>
<canvas id="myCanvas" width=2000 height=2000></canvas>
<div class="palcolor28" id="dd">
    <img id="rainbow1" src="pal00/11_1.GIF" />
    <img id="rainbow2" src="pal00/11_2.GIF" />
    <img id="rainbow3" src="pal00/11_3.GIF" /><br>
    <img id="rainbow4" src="pal00/11_4.GIF" />
    <img id="rainbow5" src="pal00/11_5.GIF" />
    <img id="rainbow6" src="pal00/11_6.GIF" />
    <img id="rainbow7" src="pal00/11_7.GIF" />
    <img id="rainbow8" src="pal00/11_8.GIF" />
    <img id="rainbow9" src="pal00/11_9.GIF" />
    <img id="rainbow10" src="pal00/11_10.GIF" />
    <img id="rainbow11" src="pal00/11_11.GIF" />
    <img id="rainbow12" src="pal00/11_12.GIF" />
    <img id="rainbow13" src="pal00/11_13.GIF" />
    <img id="rainbow14" src="pal00/11_14.GIF" />
    <img id="rainbow15" src="pal00/11_15.GIF" />
    <img id="rainbow16" src="pal00/11_16.GIF" />
    <img id="rainbow17" src="pal00/11_17.GIF" />
    <img id="rainbow18" src="pal00/11_18.GIF" />
    <img id="rainbow19" src="pal00/11_19.GIF" />
    <img id="rainbow20" src="pal00/11_20.GIF" />
    <img id="rainbow21" src="pal00/11_21.GIF" />
    <img id="rainbow22" src="pal00/11_22.GIF" />
    <img id="rainbow23" src="pal00/11_23.GIF" />
    <img id="rainbow24" src="pal00/11_24.GIF" />
    <img id="rainbow25" src="pal00/11_25.GIF" />
    <img id="rainbow26" src="pal00/11_26.GIF" />
    <img id="rainbow27" src="pal00/11_27.GIF" />
    <img id="rainbow28" src="pal00/11_28.GIF" />
</div>
    <div id="divx" class="div-x">
    <img src="transcube100.png"/>
    </div>
<div id="pl" class="pal"></div>
<div id="er" class="editrect">
    <textarea rows="10" cols="20" name="" id="remark" cols="" rows="" class="textarea220" onfocus="this.className='textarea220L';this.onmouseout='';getAddFocus('remark');" onblur="this.className='textarea220';this.onmouseout=function(){this.className='textarea220'};lostAddFocus('remark');" onmousemove="this.className='textarea220Lg'" onmouseout="this.className='textarea220'">

|qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
|qq`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q```qq`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q```
|q``q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q``q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`
|qqq````````````````````````````````````qqq````````````````````````````````````
|q```zzzzzz`qq`zzzzzzzzzzz`qq`zzzzzzz`qqq```zzzzz`qq`zzzzzzzzzzzzz`qq`zzzzzz`qq
|qqq`zzzzzz`qq`zzzzzzzzzzz`qq`zzzzzzz```qqq`zzzzz`qq`zzzzzzzzzzzzz`qq`zzzzzz```
|q```zzzzzz`qq```zzzzzz````qq`zzzzzzz`qqq```zzzzz`qq````zzzzzzz````qq`zzzzzz`qq
|qqq`zzzzzz`qqqq`zzzzzz`qqqqq`zzzzzzz```qqq`zzzzz`qqqqq`zzzzzzz`qqqqq`zzzzzz```
|q```zzzzzz`qqqq`zzzzzz`qqqqq`zzzzzzz`qqq```zzzzz`qqqqq`zzzzzzz`qqqqq`zzzzzz`qq
|qqq`zzzzzz`qqqq````````qqqqq`zzzzzzz```qqq```````qqqqq`````````qq````zzzzzz```
|q``````````qqqqqqqqqqqqqq````zzzzzzz`qqq```qqqqqq`qqqqqqqqqqqqqqq`zzz```````qq
|qqq`qqqqqqq`qqqqqqqqqqqqq`zzz``````````qqq`qqqqqqq`qqqqqqqqqqqqqq`zzz`qqqqq```
|q```qqqqqqqq`qqqqqqqqqqqq`zzz`qqqqqq`qqq``````qqqqq```````````````zzz`qqqqq`qq
|qqq````qqqqqq`````````````zzz`qqqqqq```qqq`zz`qqqqq`zzzzzzzzzzzzzz````qq``````
|q```zz`qqqqqq`zzzzzzzzzzzz````qqq````qqq```zz`qqqqq`zzqzqzqzqzqzzz`qqqqq`zz`qq
|qqq`zz````qqq`zzizizizizzz`qqqqqq`zz```qqq`zz````qq`zqqzqzqzqzqzzz`qqqqq`zz```
|q```zzzzz`qqq`ziizizizizzz`qqqqqq`zz`qqq```zzzzz`qq`zzzqqqqqqqqqqz`qq````zz`qq
|qqq`zzzzz`qqq`zzziiiiiiiiz`qqq````zz```qqq`zzzzz`qq`zqqq``````qzzz`qq`zzzzz```
|q```zzzzz`qqq`ziiizzzzizzz`qqq`zzzzz`qqq```zzzzz`qq`zzzq`zzzz`qqqz`qq`zzzzz`qq
|qqq`zzzzz`qqq`zzzizzzziiiz`qqq`zzzzz```qqq`zzzzz`qq`zqqq`zzzz`qzzz`qq`zzzzz```
|q```zzzzz`qqq`ziiizzzzizzz`qqq`zzzzz`qqq```zzzzz`qq`zzzq`zzzz`qqqz`qq`zzzzz`qq
|qqq`zzzzz`qqq`zzzizzzziiiz`qqq`zzzzz```qqq`zzzzz`qq`zqqq`zzzz`qzzz`qq`zzzzz```
|q```zz````qqq`ziiiiiiiizzz`qqq`zzzzz`qqq```zzzzz`qq`zzzq``````qqqz`qq`zzzzz`qq
|qqq`zz`qqqqqq`zzziziziziiz`qqq`zzzzz```qqq`zz````qq`zqqqqqqqqqqzzz`qq`zzzzz```
|q```zz`qqqqqq`zzzizizizizz`qqq````zz`qqq```zz`qqqqq`zzzqzqzqzqzqqz`qq````zz`qq
|qqq````qqq````zzzzzzzzzzzz`qqqqqq`zz```qqq`zz`qqqqq`zzzqzqzqzqzqzz`qqqqq`zz```
|q```qqqqqq`zzz`````````````qqqqqq````qqq``````qq````zzzzzzzzzzzzzz`qqqqq`zz`qq
|qqq`qqqqqq`zzz`qqqqqqqqqqqq`qqqqqqqq```qqq`qqqqq`zzz```````````````qqqqq``````
|q``````````zzz`qqqqqqqqqqqqq`qqqqqqq`qqq```qqqqq`zzz`qqqqqqqqqqqqqq`qqqqqqq`qq
|qqq`zzzzzzz````qqqqqqqqqqqqqq``````````qqq```````zzz`qqqqqqqqqqqqqqq`qqqqqq```
|q```zzzzzzz`qqqqq````````qqqq`zzzzzz`qqq```zzzzzz````qq`````````qqqqq```````qq
|qqq`zzzzzzz`qqqqq`zzzzzz`qqqq`zzzzzz```qqq`zzzzzz`qqqqq`zzzzzzz`qqqqq`zzzzz```
|q```zzzzzzz`qqqqq`zzzzzz`qqqq`zzzzzz`qqq```zzzzzz`qqqqq`zzzzzzz`qqqqq`zzzzz`qq
|qqq`zzzzzzz`qq````zzzzzz```qq`zzzzzz```qqq`zzzzzz`qq````zzzzzzz````qq`zzzzz```
|q```zzzzzzz`qq`zzzzzzzzzzz`qq`zzzzzz`qqq```zzzzzz`qq`zzzzzzzzzzzzz`qq`zzzzz`qq
|qqq`zzzzzzz`qq`zzzzzzzzzzz`qq`zzzzzz```qqq`zzzzzz`qq`zzzzzzzzzzzzz`qq`zzzzz```
|q````````````````````````````````````qqq````````````````````````````````````qq
|q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q``q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q``
|q```q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`qq```q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q`q
    </textarea>
</div>
<div id="bd" class="board"></div>
<div id="curcolor" class="button" style="left:360px;top:0px;background: url()"></div>
<div id="w_de" class="button" style="left:429px;top:0px">-</div>
<div id="w_in" class="button" style="left:498px;top:0px">+</div>
<div id="h_de" class="button" style="left:69px;top:169px">-</div>
<div id="h_in" class="button" style="left:0px;top:238px;">+</div>
<div id="dxr" class="button" style="left:69px;top:238px;color:green;background: url()"><img src="d2r.png"></div>
<div id="x_copy" class="button" style="left:0px;top:169px;color:yellow">X</div>
<div id="www0312" class="button" style="left:0px;top:169px;background: url()"><img src="0312www.png" width="100%"></div>
<div id="xshow" class="button" style="left:0px;top:169px;width:16px;height:16px;background: url()"><img src="xshow.png"></div>
<div id="qr" class="button" style="left:0px;top:238px;background: url()"><img src="qr.png" width="69px"></div>
<script>

    var wnan = getQueryString("wnan");

    if ( wnan != null ) {
        // hidden.
        document.getElementById("bd").style.visibility="hidden";
        document.getElementById("curcolor").style.visibility="hidden";
        document.getElementById("w_de").style.visibility="hidden";
        document.getElementById("w_in").style.visibility="hidden";
        document.getElementById("h_de").style.visibility="hidden";
        document.getElementById("h_in").style.visibility="hidden";
        document.getElementById("dxr").style.visibility="hidden";
        document.getElementById("x_copy").style.visibility="hidden";
        document.getElementById("www0312").style.visibility="hidden";
        document.getElementById("xshow").style.visibility="hidden";
        document.getElementById("qr").style.visibility="hidden";

        document.getElementById("divx").style.visibility="hidden";

    }


    var pos = document.getElementById("remark");
    var bd = document.getElementById("bd");
    bd.style.left = pos.offsetWidth + "px";
    var bt = document.getElementById("h_de");
    bt.style.top = pos.offsetHeight + 69 + "px";
    bt.style.left = pos.offsetWidth - 69 + "px";
    bt = document.getElementById("h_in");
    bt.style.top = pos.offsetHeight + 69*2 + "px";
    bt.style.left = pos.offsetWidth - 69 + "px";
    bt = document.getElementById("dxr");
    bt.style.top = pos.offsetHeight + 69*3 + "px";
    bt.style.left = pos.offsetWidth - 69 + "px";
    bt = document.getElementById("x_copy");
    bt.style.top = pos.offsetHeight + 69 + "px";
    bt = document.getElementById("www0312");
    bt.style.top = pos.offsetHeight + 69*2 + "px";
    bt = document.getElementById("xshow");
    bt.style.top = pos.offsetHeight + 69*2 + 3 + "px";
    bt = document.getElementById("qr");
    bt.style.top = pos.offsetHeight + 69*3 + "px";

    var curpalidx = 0;
    var curpalmaxidx = 2;
    setcurcolor( 'f');

    function chartoindex( c ) {
        var p = 0;
        var clrtab = "_`abcdefghijklmnopqrstuvwxyz";
        for ( p = 0; p < 28; p ++ ) {
            if ( clrtab[p] == c ) break;
        }
        if ( p == 28 ) p == -1;
        return p;
    }
    function indextochar( i ) {
        var clrtab = "_`abcdefghijklmnopqrstuvwxyz";
        return clrtab[i];
    }
    function setcurcolor( c ) {
        var p = chartoindex( c );
        if ( p != -1 ) {
            // set.
            var clrrect = document.getElementById("curcolor");
            clrrect.innerText = c;
            p += 1;
            var path = getpalpath( curpalidx );
            clrrect.style.backgroundImage= "URL(" + path + "/9_" + p + ".gif)";
            if ( p%2 === 0 )
                clrrect.style.color="black";
            else
                clrrect.style.color="white";
        }
    }

    btn = document.getElementById("w_de");
    btn.onclick = function() {
        changebuffersize( -1, 0 );
        var w_def = document.getElementById("bd");
        if ( w_def.clientWidth > 60 )
        w_def.style.width = w_def.clientWidth - 20 + "px";
    };

    btn = document.getElementById("w_in");
    btn.onclick = function() {
        changebuffersize( 1, 0 );
        var w_def = document.getElementById("bd");
        w_def.style.width = w_def.clientWidth + 20 + "px";
    };

    btn = document.getElementById("h_de");
    btn.onclick = function() {
        changebuffersize( 0, -1 );
        var w_def = document.getElementById("bd");
        if ( w_def.clientHeight > 60 )
        w_def.style.height = w_def.clientHeight - 20 + "px";
    };

    btn = document.getElementById("h_in");
    btn.onclick = function() {
        changebuffersize( 0, 1 );
        var w_def = document.getElementById("bd");
        w_def.style.height = w_def.clientHeight + 20 + "px";
    };

    btn = document.getElementById("dxr");
    btn.onclick = function() {
        window.open( "../rr/")
    };

    btn = document.getElementById("bd");
    btn.onclick = function(ev) {
        var oEvent=ev||event;
        var w_def = document.getElementById("bd");
        var x = oEvent.clientX - w_def.offsetLeft;
        var y = oEvent.clientY - w_def.offsetTop;
        x = x - x%20;
        y = y - y%20;
        x /= 20;
        y /= 20;
        // alert( x + "," + y );
        // paint by curcolor.
        var cur_clr = document.getElementById("curcolor");

        var c = cur_clr.innerText;
        var p = chartoindex( c );
        if ( p != -1 ) {
            p += 1;
            var img = new Image();
            var path = getpalpath( curpalidx );
            var img_url = path + "/9_" + p + ".gif";
            img.src = img_url;
            img.width = 19;
            img.height = 19;
            w_def.appendChild(img);
            img.style.position = 'absolute';
            img.style.left = x*20 + "px";
            img.style.top = y*20 + "px";

            // set buffer by c.
            setbufferbyc( c, x+1, y+1 );
        }
    };

    btn = document.getElementById("pl");
    var imgpl = new Image();
    imgpl.src = "palbig.png";
    btn.appendChild( imgpl );
    imgpl.style.position = 'absolute'
    imgpl.style.top = 14+"px";
    imgpl.style.left = 33+"px"
    imgpl.id = "imgpl";
//    imgpl.style.zIndex = -1;
    btn.onclick = function(ev) {
        var oEvent=ev||event;
        var x = oEvent.clientX;
        var y = oEvent.clientY - 11;

        if ( x > 8 && x < 28 && y > 0 && y < 60-11 )
        {
            changepal();
            return;
        }

        if ( x >= 29 && x <= 29+20 ) x = 1;
        else if ( x >= 52 && x <= 52+20 ) x = 2;
        else if ( x >= 75 && x <= 75+20 ) x = 3;
        else if ( x >= 99 && x <= 99+20 ) x = 4;
        else if ( x >=122 && x <=122+20 ) x = 5;
        else if ( x >=145 && x <=145+20 ) x = 6;
        else if ( x >=168 && x <=168+20 ) x = 7;
        else if ( x >=191 && x <=191+20 ) x = 8;
        else if ( x >=214 && x <=214+20 ) x = 9;
        else if ( x >=237 && x <=237+20 ) x = 10;
        else if ( x >=260 && x <=260+20 ) x = 11;
        else if ( x >=283 && x <=283+20 ) x = 12;
        else if ( x >=306 && x <=306+20 ) x = 13;
        else if ( x >=329 && x <=329+20 ) x = 14;
        else x = -1;

//        var rcarray = [29, 52, 75, 99, 122, 145, 168, 191, 214, 237, 260, 283, 306, 329];
//        for ( var i=0; i<28; i++ )
//            if ( x >= rcarray[i] && x <= rcarray[i]+20 )
//                x = i+1;
//        if ( i == 28 )
//            x = -1;
        if ( y >= 0 && y <= 20 ) y = 1;
        else if ( y >= 24 && y <= 44 ) y = 2;
        else y = -1;

        if ( x != -1 && y != -1 ) {
            var cur_clr = document.getElementById("curcolor");
            var c = indextochar( (x-1)*2 + y - 1 );
            setcurcolor( c );
        }
    }
    function getpalpath( p ) {
        var path = "pal" + ( p < 10 ? "0":"" ) + p.toString();
        return path;
    }
    function changepal()
    {
        curpalidx ++;
        if ( curpalidx > curpalmaxidx )
            curpalidx = 0;
        changepalidx( curpalidx );
        lostAddFocus( 'remark' );
    }
    function changepalidx( p )
    {
        // repaint.
        var palid = document.getElementById( "imgpl");
        var path = getpalpath( p );
        palid.src = path + ".png";

        document.getElementById("rainbow1").src = path + "/11_1.GIF";
        document.getElementById("rainbow2").src = path + "/11_2.GIF";
        document.getElementById("rainbow3").src = path + "/11_3.GIF";
        document.getElementById("rainbow4").src = path + "/11_4.GIF";
        document.getElementById("rainbow5").src = path + "/11_5.GIF";
        document.getElementById("rainbow6").src = path + "/11_6.GIF";
        document.getElementById("rainbow7").src = path + "/11_7.GIF";
        document.getElementById("rainbow8").src = path + "/11_8.GIF";
        document.getElementById("rainbow9").src = path + "/11_9.GIF";
        document.getElementById("rainbow10").src = path + "/11_10.GIF";
        document.getElementById("rainbow11").src = path + "/11_11.GIF";
        document.getElementById("rainbow12").src = path + "/11_12.GIF";
        document.getElementById("rainbow13").src = path + "/11_13.GIF";
        document.getElementById("rainbow14").src = path + "/11_14.GIF";
        document.getElementById("rainbow15").src = path + "/11_15.GIF";
        document.getElementById("rainbow16").src = path + "/11_16.GIF";
        document.getElementById("rainbow17").src = path + "/11_17.GIF";
        document.getElementById("rainbow18").src = path + "/11_18.GIF";
        document.getElementById("rainbow19").src = path + "/11_19.GIF";
        document.getElementById("rainbow20").src = path + "/11_20.GIF";
        document.getElementById("rainbow21").src = path + "/11_21.GIF";
        document.getElementById("rainbow22").src = path + "/11_22.GIF";
        document.getElementById("rainbow23").src = path + "/11_23.GIF";
        document.getElementById("rainbow24").src = path + "/11_24.GIF";
        document.getElementById("rainbow25").src = path + "/11_25.GIF";
        document.getElementById("rainbow26").src = path + "/11_26.GIF";
        document.getElementById("rainbow27").src = path + "/11_27.GIF";
        document.getElementById("rainbow28").src = path + "/11_28.GIF";
    }

    btn = document.getElementById("www0312");
    //    btn.onclick = function() { alert("comeing soon...")}
    btn.onclick = function() {
//alert("comeing soon...")
        showCustomer( "" )

    }
    //    var bdcbuffer = null;

    btn = document.getElementById("xshow");
    btn.onclick = function() {
        var bt = document.getElementById("xshow");
        if ( bt.innerHTML.substr( 11, 4 ) == 'show' )
            bt.innerHTML = "<img src='xhide.png'>"
        else
            bt.innerHTML = "<img src='xshow.png'>"
    }
    function getXshow() {
        var bt = document.getElementById("xshow");
        return ( bt.innerHTML.substr( 11, 4 ) == 'show' );
    }

    btn = document.getElementById("divx");
    btn.onclick = function(ev) {
        window.open( "?wnan=t|2019-05-08 10:43:27")
    }

    function bdwidth() {
        var w_def = document.getElementById("bd");
        return w_def.clientWidth / 20;
    }
    function bdheight() {
        var w_def = document.getElementById("bd");
        return w_def.clientHeight / 20;
    }

    var bdcbuffer = resizebuffer( bdwidth(), bdheight() );
    function resizebuffer( w, h ) {
        var tmpbuf = new String;
        for ( var j=0; j<h; j++ ) {
            var str = "";
            for (var i = 0; i < w; i++)
                str += "`";
            tmpbuf += str;
        }
        return tmpbuf;
    }

    function setbufferbyc( c, x, y ) {
        var w = bdwidth();
        var h = bdheight();
//        bdcbuffer[w*(y-1)+(x-1)] = c;
        var pos = w*(y-1)+(x-1);
        var str = bdcbuffer.substring(0,pos) + c;
        str += bdcbuffer.substr(w*(y-1)+x,w*h-pos-1);
        bdcbuffer = str;
    }

    function changebuffersize( w, h ) {
        var oldw = bdwidth();
        var oldh = bdheight();

        var str = "";
        for ( var i=0; i<oldh+h; i++ )
        {
            if ( i >= oldh )
            {
                for ( var j=0; j<oldw+w; j++ )
                    str += "`";
            } else {
                if (w >= 0) {
                    str += bdcbuffer.substr(oldw * i, oldw);
                    for (var j = 0; j < w; j++)
                        str += "`";  // add blank at end of str.
                } else
                    str += bdcbuffer.substr(oldw * i, oldw + w);
            }
        }
        bdcbuffer = str;
    }

    btn = document.getElementById("x_copy");
    btn.onclick = function() {
        var str = "\n";
        var w = bdwidth();
        var h = bdheight();

        for ( var j=0; j<h; j++ )
        {
            str += bdcbuffer.substr( w*j, w ) + "\n";
        }

        var textarea = document.getElementById("remark");
        textarea.value = str;
        lostAddFocus("remark");
    }

    function converttext2line( buf )
    {
        buf = buf.replace(/[ ]/g,"");
        buf = buf.replace(/[\r\n]/g,"|");
        buf = buf.replace(/\|\|/g,"|");

        while ( buf[0] == '|' && buf[1] == '|' )
            buf = buf.substr(1, buf.length - 1);

        while ( buf.length > 0 && buf[buf.length-1] == '|' )
            buf = buf.substr(0, buf.length - 1);
        return buf;
    }

    function showCustomer(str)
    {
//alert( "in showstr"+str );
        var xmlhttp;
        if (str=="")
        {
//            document.getElementById("txtHint").innerHTML="";
            var textarea = document.getElementById("remark");
            str = converttext2line( textarea.value );

//            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari
//  alert( "window.XMLHttpRequest" );
            xmlhttp=new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
//  alert( "!window.XMLHttpRequest" );
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
//alert( "xmlhttp.onreadystatechange=function()" );
        xmlhttp.onreadystatechange=function()
        {
            if (xmlhttp.readyState==4 && xmlhttp.status==200)
            {
//                document.getElementById("txtHint").innerHTML= getCPphpID( xmlhttp.responseText );
                //alert( xmlhttp.responseText );
                var textarea = document.getElementById("remark");
                str = converttext2line( textarea.value );

            }
        }
        if ( curpalidx > 0 ) str += "&p=" + curpalidx.toString();
        xmlhttp.open("GET","fcdbrw.php?wnan="+str,true);
        xmlhttp.send();

        if ( !getXshow() ) str += "&xs=hide"
        window.open("?wnan="+str);
    }

    function getWnanFromTime( tmstr ) {
        readrfid( tmstr )
        return null;
    }

    function readrfid( timestampstr )
    {
//alert( "in showstr"+str );
        var xmlhttp;
//        if (str=="")
//        {
//            document.getElementById("txtHint").innerHTML="";
//            return;
//        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari
//  alert( "window.XMLHttpRequest" );
            xmlhttp=new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
//  alert( "!window.XMLHttpRequest" );
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
//alert( "xmlhttp.onreadystatechange=function()" );
        xmlhttp.onreadystatechange=function()
        {
            if (xmlhttp.readyState==4 && xmlhttp.status==200)
            {
//                document.getElementById("txtHint").innerHTML= getCPphpID( xmlhttp.responseText );
                //alert( xmlhttp.responseText );
                readrfid_getCPphpID_1line( xmlhttp.responseText );
            } // else
              //   readrfid_getCPphpID( "r|dddd|1<br>r|dddd|dddd|dddd|<br>" )
              // hidden debug string.
//            else // 12327 is the pos, then color pixel, end ret & color (if have not, not filling all.)
//                readrfid_getCPphpID_1line( "r|1,x|2,y|3,n|2,d|7,m|r,n<br>")  // this format only for 1line editing.
        }
        xmlhttp.open("GET","rfidr1.php?time="+timestampstr,true);
        xmlhttp.send();
    }

    function readrfid_getCPphpID_1line( ret ) {
        if ( ret.substring( ret.length-4, ret.length ) == "<br>" )
            ret = ret.substr( 0, ret.length-4 );
        if ( ret.charAt(1) == 'x' && ret.charAt(2) == '|' )
            location.href = "../rr/index.html?wnan="+ret.substring( 2, ret.length );
        else if ( ret.charAt(1) == '|')
            location.href = "?wnan="+ret;
    }

</script>
</body>
</html>